package com.qf.controller;


import com.qf.pojo.resp.BaseResp;
import com.qf.service.PicShareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("/picShare")
public class PicShareController {
    @Autowired
    PicShareService picShareService;


    //首页轮播图展示点赞数最高的五张图片
    @RequestMapping("/findPic")
    public BaseResp findPic() {
        return picShareService.findPic();
    }

    //首页分享展示
    @RequestMapping("/findShare")
    public BaseResp findShare() {
        return picShareService.findShare();
    }

    //点赞
    @RequestMapping("/addgood")
    public BaseResp addgood(@RequestBody Map map, HttpServletRequest request) {
        return picShareService.addgood(Integer.valueOf(map.get("id").toString()));
    }

    @RequestMapping("/findUserShare")
    public BaseResp findUserShare(@RequestBody Map map){
        System.out.println(Integer.valueOf(map.get("id").toString()));
        return picShareService.findUserShare(Integer.valueOf(map.get("id").toString()));
    }
}
